/*
 * PopupStatisticsUpdateMsg.hpp
 *
 *  Created on: Jul 25, 2012
 *      Author: guillou
 */

#ifndef POPUPSTATISTICSUPDATEMSG_HPP_
#define POPUPSTATISTICSUPDATEMSG_HPP_

#include <PopupLibTypes.hpp>
#include "PopupAbstractMessage.hpp"

namespace Popup
{
  struct StatisticsUpdateMsg : public AbstractMessage
  {
    enum
    {
      USERID = POPUP_RATE_ITEM_MAX+1,
      RECORDMASK
    };

    //! Constructor used in order to send
    StatisticsUpdateMsg(UserID p_userID) :
      AbstractMessage(POPUP_MSG_TYPE_STATISTICS_UPDATE), userID(p_userID) {}

    //! Constructor used in order to receive
    StatisticsUpdateMsg(const Message *p_message);

    //!@Override
    bool onSend();

    //!@Override
    bool onReceive();

    inline const UserStatistics & statistics() const { return stats; }
    inline UserStatistics & statistics() { return stats; }
    inline UserID getUserID() const { return userID; }

  private:
    UserID userID;
    UserStatistics stats;
  };
}

#endif /* POPUPSTATISTICSUPDATEMSG_HPP_ */
